package com.googlecode.kipler.container.dl.operational;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.kipler.container.dl.FormulaBase;
import com.googlecode.kipler.container.dl.Individual;
import com.googlecode.kipler.satisfiability.reasoner.UnsatisfiableException;
import com.googlecode.kipler.syntax.formula.Formula;


/**
 * 
 * @author İnanç Seylan
 *
 */
public class ConcreteABoxChangeSubject implements
		ABoxChangeSubject {
	private List<ABoxChangeObserver> observers = new ArrayList<ABoxChangeObserver>();

	public void addObserver(ABoxChangeObserver observer) {
		observers.add(observer);
	}

	public void notifyAddition(FormulaBase fBase, Formula formula)
			throws UnsatisfiableException {
		for (ABoxChangeObserver observer : observers) {
			observer.afterFormulaIsAdded(fBase, formula);
		}
	}

	public void notifyRemoval(FormulaBase fBase, Individual indv) {
		for (ABoxChangeObserver observer : observers) {
			observer.afterNodeIsRemoved(fBase, indv);
		}
	}

}
